{% extends "/shared/layout.html" %}
{% block mainContent %}
<div class="header">
  <div class="wrapper">
    <ul>
      <li class="li_750">
        {% include "/shared/user_partial.html" %}
      </li>
      <li class="li_250">
        <div class="u_message">
          <dl>
            <dd id="lblStationCount" class="ddHover" title="{{pageRes.lblStationCountTip}}">
              <em class="icon_hardware"></em>
              {% if hardwareInfo.has_hardware %}
                {{pageRes.lblHasStation|safe}}
              {% else %}
                {{pageRes.lblNoStation|safe}}
              {% endif %}
            </dd>
          </dl>
        </div>
      </li>
    </ul>
  </div>
</div>
<div class="step_head"></div>
<div class="wrapper hd_main">
  <div class="step step1">
    <div class="operate">
      <div class="op_wrap">
        <div class="prompt">{{pageRes.stationMsg}}</div>
        <a id="btnRefresh" href="/hardware/index" class="button">{{pageRes.btnRefresh}}</a>
      </div>
      <div class="result">
        <br><br><br>
        <div class="prompt">{{pageRes.stationSuccessMsg|safe}}</div>
      </div>
      
      
      <!--<div class="op_wrap">
        <div class="prompt">关联ET•Station和您正在使用的wifi (ET•Station首次及每次进入新的wifi环境时都需要绑定).</div>
        <a id="btnAddStation" href="###" class="button">添加ET.Station</a>
      </div>
      <div id="smartForm" class="et_form operate_form">
        <ul>
          <li>
            <label>Wifi名称：</label>
            <input class="txtSSID" type="text" value="" />
            <span></span>
          </li>
          <li>
            <label>Wifi密码：</label>
            <input class="txtPwd" type="password" value="" />
            <span></span>
          </li>
          <li>
            <label>网关：</label>
            <input class="txtGateway" type="text" value="" />
            <span></span>
          </li>
        </ul>
        <div class="bottom">
          <a id="btnConfigStation" class="button">配置</a> 
          <a href="http://www.java.com/" class="link" target="_blank">手动安装java</a>
        </div>
        <div class="prompt" style="display:none;">正在连接中,大概需要1分钟,请耐心等待...</div>
      </div>
      <div class="result">
        <div class="prompt">您的ET.Station已配置成功啦！</div><br><br>
        <a id="btnEditStation" href="###" class="button">修改ET.Station</a>
      </div>-->
    </div>
    <div class="state">ET<br/> Station</div>
    <div class="desc">
      <!--<p class="title">清闲小资飞扬版:</p>
      <p>ET App"ETLinking"中"硬件绑定",只需输入相应的wifi密码,即刻绑定成功.   <a id="btnRefresh" class="link" href="###">点击刷新</a>  ET.Station状态</p>
      <p class="title">技术达人挑战版：</p>
      <p>1、网站允许自动下载java TM,运行成功:输入wifi名称和密码,和网关IP地址,点击"配置";</p>
      <p>2、请按ETStation上的按钮,查看ETStation上的灯是否是绿色;待本页面齿轮运转起来代表配置成功,恭喜您挑战成功!</p>-->
    </div>
  </div>
  <div class="step step2">
    <div class="desc"></div>
    <div class="state">ET<br/> GO</div>
    <div class="operate">
      <div class="op_wrap">
        <div class="prompt">{{pageRes.stationStatusMsg}}</div>
        <a id="btnAddGo" href="###" class="button">{{pageRes.btnAddGo}}</a>
      </div>
        <div class="et_form operate_form">
          <div class="prompt">{{pageRes.etgoMsg}}</div>
          <ul>
            <li>
              <label>{{pageRes.lblSerial}}：</label>
              <input id="txtDeviceId" type="text" value="" />
            </li>
          </ul>
          <div class="bottom">
            <button id="btnBindGo" class="form_button">{{pageRes.btnBindGo}}</button>
            <a id="btnGetDevice" style="color:#fff;" href="###">{{pageRes.linkGetSerial}}</a>
          </div>
        </div>
        <div id="settingTime" class="result">
          <div class="prompt">{{pageRes.lblCurSerial}}：<span id="currentDeviceId">{{hardwareInfo.device_id}}</span>   <a id="btnUnBind" href="###">{{pageRes.linkUnBind}}</a></div>
          <label><input id="rdUpload" type="radio" checked="checked" name="setting" value="upload" />{{pageRes.lblUploadTime}}</label>
          <label><input id="rdSleep" type="radio" name="setting" value="sleep" />{{pageRes.lblSleepTime}}</label>
          <div class="upload_time">
            <select class="hour"></select>:<select class="minute"></select>
          </div>
          <div class="sleep_time">
            <select class="hour start"></select>:<select class="minute start"></select>
            --
            <select class="hour end"></select>:<select class="minute end"></select>
          </div>
          <div class="bottom">
            <a id="btnConfirm" href="###" class="button">{{pageRes.btnConfirm}}</a>
            <a id="btnRevert" href="###" class="button">{{pageRes.btnRevert}}</a>
          </div>
        </div>
    </div>
  </div>
</div>
<div class="step_bottom"></div>
<script type="text/javascript" src="../static/scripts/views/hardware/etlinking.views.hardware.js"></script>
<script type="text/javascript">
  $(function() {
    var config = {
      uploadTime:"{{hardwareInfo.auto_upload}}",
      sleepStartTime:"{{hardwareInfo.sleep_start}}",
      sleepEndTime:"{{hardwareInfo.sleep_end}}",
      deviceId:"{{hardwareInfo.device_id}}"
    };
    nsbase.views.hardware.init(config); 
  });

  function onAppletLoad () {
    nsbase.views.hardware.appletLoad();
  }

  function onSmartConfigConnect(param){
    switch(param)
    {
      case "FTC_SUCCESS":
        alert("Successful connection");
        break;
        
      case "FTC_ERROR":
        alert("Unknown error");
        break;
        
      case "FTC_TIMEOUT":
        alert("Connection timeout");
        break;
    }
    
    console.log(param);
  }

</script>
{% endblock %}